package abg.manage.controller.jy;

import abg.core.common.security.Auth;
import abg.core.domain.db.AaTask;
import abg.core.domain.db.AaXqCj;
import abg.core.domain.search.JwTaskPsh;
import abg.core.domain.search.TCourseFilePsh;
import abg.core.domain.search.TCoursePsh;
import abg.core.domain.sys.SRS;
import abg.core.service.jldz.JldzService;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 教务处
 */
@Auth(role = {"60"})
@RestController
@RequestMapping("/manage/jldz/jw")
public class JwC {

    @Resource
    private JldzService jldzService;


    /**
     * 教务处任务分页查询
     */
    @PostMapping(value = "/pageTask")
    public SRS<Page<AaTask>> pageTask(JwTaskPsh pageSearch) {
        Page<AaTask> page = jldzService.jwPageTask(pageSearch);

        return SRS.bySuccess(page);
    }

    /**
     * 教务处添加任务
     */
    @PostMapping(value = "/addTask")
    public SRS<Object> addTask(AaTask param) {
        boolean b = jldzService.jwAddTask(param);
        return SRS.bySuccess();
    }


    /**
     * 教务处关闭任务
     */
    @PostMapping(value = "/updateTask")
    public SRS<Object> updateTask(AaTask param) {
        boolean b = jldzService.jwUpdateTask(param);
        return SRS.bySuccess();
    }


    /**
     * 教务处关闭任务
     */
    @PostMapping(value = "/updateTaskStatus")
    public SRS<Object> updateTaskStatus(String ids, String isOpen) {
        boolean b = jldzService.updateTaskStatus(ids, isOpen);
        return SRS.bySuccess();
    }

    /**
     * 教务处删除任务
     */
    @PostMapping(value = "/delTask")
    public SRS<Object> delTask(String ids) {
        boolean b = jldzService.jwDelTask(ids);
        return SRS.bySuccess();
    }

    //课程
    @PostMapping("/course")
    public SRS<Page<AaXqCj>> teacherCourse(TCoursePsh pageSearch) {
        Page page = jldzService.teacherCourse(pageSearch);
        return SRS.bySuccess(page);
    }


    //课程
    @PostMapping("/courseFile")
    public SRS<Page<AaXqCj>> courseFile(TCourseFilePsh pageSearch) {

        Page page = jldzService.teacherCourseFile(pageSearch);
        return SRS.bySuccess(page);
    }


}
